package com.system.weirdor.module.mapper;

import com.system.weirdor.module.entity.Role;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultType;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * <p>
  * 角色 Mapper 接口
 * </p>
 *
 * @author Weridor
 * @since 2017-08-31
 */
public interface RoleMapper extends BaseMapper<Role> {

    @Select("select role_id AS roleId from user_role where user_id = #{userId}")
    @ResultType(Long.class)
    List<Long> selectRoleIdListByUserId(@Param("userId") Long id);

    List<Map<Long,String>> selectResourceListByRoleId(Long roleId);

    List<String> listUserRoles(Long userId);
}